<?php
	echo $this->Html->script(array('ckeditor/ckeditor','ckfinder/ckfinder'));
?>
  <style>
		.keke ul{
			float:left; width:600px; padding-left:5px;
		}
		.keke ul li{
			float:left;
			margin:0px 12px;
			list-style-type: none;
			height:50px;
		}
 </style>  
<script language="javascript" type="text/javascript">
/*<![CDATA[*/
	$(function(){
		$("#lnkSave").click(function(){
			$('#adminForm').submit();
		});

		$("#lnkClose").click(function(){
			window.location = '<?php echo DOMAIN ?>/products';
		});
		
		
		$("#adminForm").validate({
			rules: {
				txtName: "required",
				txtOrder: "required",
			},
			messages: {
				txtName: "Bạn chưa nhập tên chuyên mục!",
				txtOrder: "Bạn chưa nhập số thứ tự!",
			}
		});
	});
/*]]>*/
	function Checkvalue(ElementID){
		var checkBox = document.getElementById(ElementID);
		if(checkBox.checked==true)
			checkBox.value=1; 
		else checkBox.value=0; 
	}
</script>

<div id="content-box">
	<div class="border">
		<div class="padding">
			<div id="toolbar-box">
   			<div class="t"><div class="t"><div class="t"></div></div></div>
			<div class="m">
				<div class="toolbar" id="toolbar">
				<table class="toolbar">
				<tr>
					<td class="button" id="toolbar-save">
					<a href="javascript:;//Cập nhật" id="lnkSave" class="toolbar">
						<span class="icon-32-save" title="Cập nhật"></span>
						Cập nhật
					</a>
					</td>
					<td class="button" id="toolbar-cancel">
					<a href="javascript:;//Đóng" id="lnkClose" class="toolbar">
						<span class="icon-32-cancel" title="Đóng"></span>
						Đóng
					</a>
					</td>
				</tr>
				</table>
				</div>
				<div class="header icon-48-langmanager">Thêm danh mục sản phẩm</div>
				<div class="clr"></div>
			</div>
			<div class="b"><div class="b"><div class="b"></div></div></div>
			</div>
			<div class="clr"></div>
			<div id="element-box">
				<div class="t"><div class="t"><div class="t"></div></div></div>
				<div class="m">
				<form action="<?php echo DOMAIN?>/products/add" method="post" name="adminForm" enctype="multipart/form-data" id="adminForm" autocomplete="off">
					<div class="col width-60">
						<fieldset class="adminform">
						<legend>Thông tin chi tiết</legend>
						<table class="admintable" cellspacing="1">
						<tr>
							<td width="150" class="key">
								<label for="txtName">Tên sản phẩm</label>
							</td>
							<td>
								 <?php echo $form->input('Product.name',array( 'label' => '','id'=>'txtName','class'=>'inputbox','size'=>'80'));?>
							</td>
						</tr>
                        <tr>
							<td width="150" class="key">
								<label for="txtName">Mã sản phẩm</label>
							</td>
							<td>
								 <?php echo $form->input('Product.code',array( 'label' => '','id'=>'txtName','class'=>'inputbox','size'=>'80'));?>
							</td>
						</tr>
                         <tr>
							<td width="150" class="key">
								<label for="txtName">Giá sản phẩm</label>
							</td>
							<td>
								 <?php echo $form->input('Product.cost',array( 'label' => '','id'=>'txtName','class'=>'inputbox','size'=>'80'));?>
							</td>
						</tr>
                         <tr>
							<td width="150" class="key">
								<label for="txtName">Đơn vị tính</label>
							</td>
							<td>
								 <?php // echo $form->input('Product.sp_gia',array( 'label' => '','id'=>'txtName','class'=>'inputbox','size'=>'80'));?>
                                 <?php echo $form->input('Product.type', array('label'=>'','id'=>'txtName','class'=>'inputbox1','options' => array(
									'0'=>'VNĐ',
									'1'=>'USD'									
								 ))); ?>
							</td>
						</tr>
                         
                     
						<tr>
							<td class="key">
								<label for="ddlParent">Danh mục sản phẩm</label>
							</td>
							<td>
					  			<?php echo $form->select('Product.category_id',$categorylist, null,array('empty'=>'--Chọn danh mục --','id'=>'ddlParent'));?> 
							</td>
						</tr>
					   
						
                       
						
						<tr>
							<td class="key">
								<label for="txtOrder">Thứ tự</label>
							</td>
							<td>
								<?php echo $form->input('Product.order',array( 'label' => '','id'=>'txtOrder','class'=>'inputbox','size'=>'40'));?>
							</td>
						</tr>
						<tr>
							<td class="key">
								<label for="txtImage">Ảnh sản phẩm</label>
							</td>
							<td>
							 <?php echo $this->Form->input('Product.sp_anh',array('class'=>'inputbox','id'=>'txtImage','size'=>'40','label'=>false,'readonly'=>true,'id'=>'imagesid')); ?> 
    <div style="position:relative; top:-20px; left:240px;"><a href="javascript:window.open('<?php echo DOMAIN; ?>/upload.php','images','left=400,top=100,width=500,height=300');window.history.go(1)">Upload</a></div>
    <div class="functionBtnEvent" style="width:100%; padding-left:11px;"><img id="images-default" name="imagesdefault" src="<?php echo DOMAIN ?>/img/no-images.jpg" width="100"></img></div>
							</td>
						</tr>
                        <tr>
							<td width="150" class="key">
								<label for="txtMetaTitle">Mô tả tóm tắt sản pẩm</label>
							</td>
							<td>
								
                                 <?php  echo $this->Form->input('Product.sp_tomtat', array('cols'=>82, 'rows'=>7, 'type'=>'textarea','label'=>'','id'=>'txtMetaTitle'));?> 
							</td>
						</tr>
						<tr>
							<td class="key">
								<label for="txtDescription">Thông số kỹ thuật</label>
							</td>
							<td>
							<?php  echo $this->Form->input('Product.sp_mota',array('label'=>'')).$this->TvFck->create('Product.sp_mota',array('toolbar'=>'extra','height'=>'150px','width'=>'600')); ?>
							</td>
							</td>
						</tr>
						
						</table>
						</fieldset>
					</div>
					<div class="col width-40">
						<fieldset class="adminform">
						<legend>Mở rộng</legend>
						<table cellspacing="1" class="admintable">
						<tbody>
						<tr>
							<td class="key">
								<label for="chekActive">Trạng thái</label>
							</td>
							<td>
								<?php	echo $this->Form->input('Product.status',array('type'=>'checkbox','label'=>false)); ?>
								<label id="lbActive">Hoạt động</label>
							</td>
						</tr>
						
						<tr>
							<td class="key">
								<label for="chekActive">Tiếp tục cập nhật</label>
							</td>
							<td>
								<?php	echo $this->Form->input('Product.check',array('type'=>'checkbox','label'=>false)); ?>
								<label id="lbActive">Có</label>
							</td>
						</tr>
						
						<tr>
							<td class="key">
								<label for="listnhom">Ngày tạo</label>
							</td>
							<td>
								<?php  $time = time(); echo date("d-m-Y",$time); ?>
							</td>
						</tr>
						</tbody></table>
						</fieldset>
						<fieldset class="adminform">
						<legend>Meta Data</legend>
						<table cellspacing="1" class="admintable">
						<tbody>
						<tr>
							<td width="150" class="key">
								<label for="txtMetaTitle">Meta Title</label>
							</td>
							<td>
								
                                 <?php  echo $this->Form->input('Product.sp_title', array('cols'=>50, 'rows'=>5, 'type'=>'textarea','label'=>'','id'=>'txtMetaTitle'));?> 
							</td>
						</tr>
						<tr>
							<td width="150" class="key">
								<label for="txtMetaKeyword">Meta Keyword</label>
							</td>
							<td>
								
                                
                                 <?php  echo $this->Form->input('Product.sp_keyword', array('cols'=>50, 'rows'=>5, 'type'=>'textarea','label'=>'','id'=>'txtMetaKeyword'));?> 
                               
							</td>
						</tr>
						<tr>
							<td class="key">
								<label for="txtMetaDescription">Meta Description</label>
							</td>
							<td>
								  <?php  echo $this->Form->input('Product.sp_des', array('cols'=>50, 'rows'=>5, 'type'=>'textarea','label'=>'','id'=>'txtMetaDescription'));?> 
							</td>
						</tr>
						</tbody></table>
						</fieldset>
					</div>
					<div class="clr"></div>
					<input type="hidden" name="hndId" id="hndId" value="<?php //echo $id?>" />
				</form>
				<div class="clr"></div>
				</div>
				<div class="b"><div class="b"><div class="b"></div></div></div>
			</div>
			<noscript>Warning! JavaScript must be enabled for proper operation of the Administrator back-end.</noscript>
			<div class="clr"></div>
		</div>
		<div class="clr"></div>
	</div>
</div>
